<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <style type="text/css">
        #imglist img{
            width: 300px;
            height: 200px;
        }
    </style>
</head>
<body>
     <div id="box"></div>
   
<script>
    var box = document.getElementById("box");

   window.onresize = function(){
        //box.innerHTML = Math.random();

        var color = '#'+Math.floor(Math.random() * 167777215).toString(16);
        document.body.style.backgroundColor = color;
        console.log(color);
   }
</script>
</html>